package com.bckj.fastboot.core.extra.elasticsearch.configuration;

import com.bckj.fastboot.core.extra.elasticsearch.ElasticsearchOps;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;

/**
 * ElasticsearchConfiguration
 *
 * @author wfc
 **/
@AutoConfiguration
@ConditionalOnClass(ElasticsearchOperations.class)
public class ElasticsearchConfiguration {

    @Bean
    @ConditionalOnBean(ElasticsearchOperations.class)
    public ElasticsearchOps elasticsearchOps(ElasticsearchOperations elasticsearchOperations) {
        return new ElasticsearchOps(elasticsearchOperations);
    }
}
